< previous page page_127 next page >

Page 127
    Dim intMinLen As Integer
    Dim intMaxLen As Integer
    Dim strMinMaxMsg As String
    '
    Dim blnOK As Boolean
    '
    intHigh = 100
    intLow = 1
    strHighLowMsg = "High/Low field must contain a value between " & _
       CStr(intLow) & " and " & CStr(intHigh)
    '
    intMinLen = 3
    intMaxLen = 10
    strMinMaxMsg = "Upper field must be between " & _
       CStr(intMinLen) & " and " & CStr(intMaxLen) & " long."
    '
    blnOK = False
    '
    ' check high/low field
    If Val(txtHighLow) < intLow Or Val(txtHighLow) > intHigh Then
        MsgBox strHighLowMsg
        blnOK = False
        txtHighLow.SetFocus
    End If
    '
    ' check upper field
    If Len(txtUpper) < intMinLen Or Len(txtUpper) > intMaxLen Then
        MsgBox strMinMaxMsg
        blnOK = False
        txtUpper.SetFocus
    End If
    '
    ' check the combined field
    If Len(Trim(txtCombined)) = 0 Then
        MsgBox "Combined field is a required field"
        blnOK = False
        txtCombined.SetFocus
    End If
    '
    ' check conditoinal upper/custtype fields
    If Len(Trim(txtUpper)) <> 0 And Len(Trim(cboCustType)) = 0 Then
        MsgBox "If Upper field conains data then " & _
          "the Customer Type field must also contain data"
        blnOK = False
        cboCustType.SetFocus
    End If
    '
    ' set if all passed
    If blnOK = True Then
        Unload Me
    End If
    '
End Sub

 
< previous page page_127 next page >

If you like this book, buy it!